<template>
  <div class="home">
    <home-head></home-head>
    <div class="homeContent"></div>
  </div>
</template>

<script>
import homeHead from '~/components/layout/homeHead.vue'
import { mapMutations, mapGetters, mapActions } from "vuex";
export default {
    layout: 'current',
    watchQuery: ['page'],
    // validate({ params, store }) {
    //     let id = params.id || null;
    //     let userInfo = store.state.userInfo || null;
    //     console.log(id);
    //     console.log(store.state.userInfo);
    // },
    data() {
      return {
        fileList: [],
        url: ''
      }
    },
    computed: {
      ...mapGetters(['userInfo']),
      curPage() {
        if (this.$route.query.page) {
          return this.$route.query.page;
        }
        return '';
      }
    },
    components: {
      homeHead
    },
    methods: {
      ...mapActions({
        uploadFile: "uploadFile"
      }),
      async beforeUpload(file) {
        let formdata = new FormData();
        formdata.append('file', file.raw, file.name);
        let result = await this.uploadFile(formdata);
        this.url = result.data.url;
        console.log(result);
      }
    }
}
</script>
